﻿
#include "ZKCXJL.h"
#include "afxdialogex.h"

using namespace DIO;

CString strktqbh;
CString strzkbh;
// ZKCXJL 对话框

IMPLEMENT_DYNAMIC(ZKCXJL, CDialogEx)

ZKCXJL::ZKCXJL(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_ZKCXJL, pParent)
{

}

ZKCXJL::~ZKCXJL()
{
}

void ZKCXJL::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_ZKCX_LIST, ZKCXJLLIST);
	DDX_Control(pDX, IDC_COMBO_ZKCXKTQBH, m_zkcxktq);
	DDX_Control(pDX, IDC_COMBO_ZKCXZKBH, m_zkcxzkbh);
}


BEGIN_MESSAGE_MAP(ZKCXJL, CDialogEx)
	ON_CBN_SELCHANGE(IDC_COMBO_ZKCXKTQBH, &ZKCXJL::OnCbnSelchangeComboZkcxktqbh)
	ON_CBN_SELCHANGE(IDC_COMBO_ZKCXZKBH, &ZKCXJL::OnCbnSelchangeComboZkcxzkbh)
	ON_BN_CLICKED(IDC_ZKCX_ADD1, &ZKCXJL::OnBnClickedZkcxAdd1)
END_MESSAGE_MAP()


// ZKCXJL 消息处理程序


BOOL ZKCXJL::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化

	CString GKTitleName;
	//GKTitleName = "钻孔测斜记录表";

	DWORD dwStyle = ZKCXJLLIST.GetExtendedStyle();
	ZKCXJLLIST.SetExtendedStyle(dwStyle | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
	ZKCXJLLIST.InsertColumn(0, _T("MDBTAD(勘探区编号)"), LVCFMT_CENTER, 200);
	ZKCXJLLIST.InsertColumn(1, _T("GCJCBN(钻孔编号)"), LVCFMT_CENTER, 140);
	ZKCXJLLIST.InsertColumn(2, _T("WTJDIH(测点号)"), LVCFMT_CENTER, 140);
	ZKCXJLLIST.InsertColumn(3, _T("WTHEBA(测点深度)"), LVCFMT_CENTER, 180);
	ZKCXJLLIST.InsertColumn(4, _T("WTHGFC(偏斜角采用值)"), LVCFMT_CENTER, 140);
	ZKCXJLLIST.InsertColumn(5, _T("WTHGFE(方位角检查值)"), LVCFMT_CENTER, 140);
	ZKCXJLLIST.InsertColumn(6, _T("WTHGFF(方位角采用值)"), LVCFMT_CENTER, 140);

	//下拉框的实现
	m_zkcxktq.AddString(TEXT("选择勘探区编号"));
	m_zkcxktq.SetCurSel(0);
	m_zkcxktq.AddString(TEXT("654324000000001"));
	//m_zkcxktq.AddString(TEXT("3"));



	//User_ST user;
	//UserDrillDao uddcx;
	//vector<DrillGeneral_ST> cname = uddcx.selectExplor(user);
	//根据钻孔号查询出钻孔概况记录，然后存入result中
	//vector<DrillCexie_ST> result;
	//DrillCexieDAO dcdcx;
	//for (unsigned int i = 0; i < cname.size(); i++)
	//{
	//	CString str;
	//	result[i].kantanqu_no = str;
	//	((CComboBox*)GetDlgItem(IDC_COMBO_ZKCXKTQBH))->AddString(str);
	//}


	m_zkcxzkbh.AddString(TEXT("选择钻孔编号"));
	//默认显示（0表示第一行）
	m_zkcxzkbh.SetCurSel(0);
	m_zkcxzkbh.AddString(TEXT("JZK1306"));
	m_zkcxzkbh.AddString(TEXT("ZK0103"));
	m_zkcxzkbh.AddString(TEXT("ZK0104"));
	m_zkcxzkbh.AddString(TEXT("ZK0105"));
	m_zkcxzkbh.AddString(TEXT("JZK106"));
	m_zkcxzkbh.AddString(TEXT("ZK0107"));
	m_zkcxzkbh.AddString(TEXT("ZK0108"));
	m_zkcxzkbh.AddString(TEXT("ZK0109"));
	
	
	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE

}
//void ZKCXJL::OnBnClickedZkcxAdd()
//{
//	// TODO: 在此添加控件通知处理程序代码
//	DrillCexie_ST drill;
//
//	CString strktqbh;
//	GetDlgItem(IDC_ZKCX_KTQBH)->GetWindowText(strktqbh);
//	drill.kantanqu_no = strktqbh;
//
//	drill.drill_no = strzkbh;
//	GetDlgItem(IDC_ZKCX_ZKBH)->GetWindowText(strzkbh);
//	drill.drill_no = strzkbh;
//
//	CString zkcx_cdh;
//	GetDlgItem(IDC_ZKCX_CDH)->GetWindowText(zkcx_cdh);
//	drill.point_no = zkcx_cdh;
//
//	CString zkcx_cdsd;
//	GetDlgItem(IDC_ZKCX_CDSD)->GetWindowText(zkcx_cdsd);
//	drill.point_no = zkcx_cdh;
//
//	CString zkcx_pxjcyz;
//	GetDlgItem(IDC_ZKCX_PXJCYZ)->GetWindowText(zkcx_pxjcyz);
//	double point_pxangle_used =atof( zkcx_pxjcyz);
//	drill.point_pxangle_used = point_pxangle_used;
//
//	CString zkcx_fwjjcz;
//	GetDlgItem(IDC_ZKCX_FWJCYZ)->GetWindowText(zkcx_fwjjcz);
//	double point_fwangle_checked = atof(zkcx_fwjjcz);
//	drill.point_no = zkcx_fwjjcz;
//
//	CString zkcx_fxjcyz;
//	GetDlgItem(IDC_ZKCX_FWJCYZ)->GetWindowText(zkcx_fxjcyz);
//	double point_fwangle_used =atof( zkcx_fxjcyz);
//	drill.point_fwangle_used = point_fwangle_used;
//	
//	int nindex = ZKCXJLLIST.InsertItem(1, strktqbh);
//	ZKCXJLLIST.SetItemText(nindex, 1, strzkbh);
//	ZKCXJLLIST.SetItemText(nindex, 2, zkcx_cdh);
//	ZKCXJLLIST.SetItemText(nindex, 3, zkcx_cdsd);
//	ZKCXJLLIST.SetItemText(nindex, 4, zkcx_pxjcyz);
//	ZKCXJLLIST.SetItemText(nindex, 5, zkcx_fwjjcz);
//	ZKCXJLLIST.SetItemText(nindex, 6, zkcx_fxjcyz);
//
//	UserInsertDMZK0202(drill);
//}



//下拉列表获得勘探区编号
void ZKCXJL::OnCbnSelchangeComboZkcxktqbh()
{
	// TODO: 在此添加控件通知处理程序代码
	
	//获取某个索引
	int index = m_zkcxktq.GetCurSel();
	//获得勘探区编号
	m_zkcxktq.GetLBText(index, strktqbh);
	
}


//下拉列表获得钻孔编号
void ZKCXJL::OnCbnSelchangeComboZkcxzkbh()
{
	// TODO: 在此添加控件通知处理程序代码
	
	//获取某个索引
	int index = m_zkcxktq.GetCurSel();
	//获得列表钻孔编号
	m_zkcxktq.GetLBText(index, strzkbh);
}


void ZKCXJL::OnBnClickedZkcxAdd1()
{
	// TODO: 在此添加控件通知处理程序代码
	// TODO: 在此添加控件通知处理程序代码
	DrillCexie_ST drill;

	CString strktqbh;
	GetDlgItem(IDC_ZKCX_KTQBH)->GetWindowText(strktqbh);
	drill.kantanqu_no = strktqbh;

	drill.drill_no = strzkbh;
	GetDlgItem(IDC_ZKCX_ZKBH)->GetWindowText(strzkbh);
	drill.drill_no = strzkbh;

	CString zkcx_cdh;
	GetDlgItem(IDC_ZKCX_CDH)->GetWindowText(zkcx_cdh);
	drill.point_no = zkcx_cdh;

	CString zkcx_cdsd;
	GetDlgItem(IDC_ZKCX_CDSD)->GetWindowText(zkcx_cdsd);
	drill.point_no = zkcx_cdh;

	CString zkcx_pxjcyz;
	GetDlgItem(IDC_ZKCX_PXJCYZ)->GetWindowText(zkcx_pxjcyz);
	double point_pxangle_used = atof(zkcx_pxjcyz);
	drill.point_pxangle_used = point_pxangle_used;

	CString zkcx_fwjjcz;
	GetDlgItem(IDC_ZKCX_FWJCYZ)->GetWindowText(zkcx_fwjjcz);
	double point_fwangle_checked = atof(zkcx_fwjjcz);
	drill.point_no = zkcx_fwjjcz;

	CString zkcx_fxjcyz;
	GetDlgItem(IDC_ZKCX_FWJCYZ)->GetWindowText(zkcx_fxjcyz);
	double point_fwangle_used = atof(zkcx_fxjcyz);
	drill.point_fwangle_used = point_fwangle_used;

	int nindex = ZKCXJLLIST.InsertItem(1, strktqbh);
	ZKCXJLLIST.SetItemText(nindex, 1, strzkbh);
	ZKCXJLLIST.SetItemText(nindex, 2, zkcx_cdh);
	ZKCXJLLIST.SetItemText(nindex, 3, zkcx_cdsd);
	ZKCXJLLIST.SetItemText(nindex, 4, zkcx_pxjcyz);
	ZKCXJLLIST.SetItemText(nindex, 5, zkcx_fwjjcz);
	ZKCXJLLIST.SetItemText(nindex, 6, zkcx_fxjcyz);

	UserInsertDMZK0202(drill);
}
